package tools;

public class ConvertUtils {
    public static void main(String[] args) {
        int i = 10;
        String binaryString = Integer.toBinaryString(i);
        String hexString = Integer.toHexString(i);
        String octalString = Integer.toOctalString(i);
        // 二进制
        System.out.println(binaryString);
        // 16进制
        System.out.println(hexString);
        // 8进制
        System.out.println(octalString);


        //保留两位小数
        test();
    }
    public static void test() {
        double d = 0.345678;
        System.out.println("保留两位小数：" + String.format("%.2f", d));
    }
}
